<!-- DataGovernanceBoard.vue -->
<template>
  <div class="data-governance-board">
    <div class="dashboard-header">
      <h1 class="dashboard-title">电磁数据标准化看板</h1>
      <div class="dashboard-controls">
        <el-select v-model="dataSource" size="small" placeholder="数据源选择">
          <el-option
              v-for="item in dataSources"
              :key="item.value"
              :label="item.label"
              :value="item.value"
          />
        </el-select>
        <el-button type="primary" size="small" @click="refreshData">
          <el-icon><Refresh /></el-icon>
          刷新数据
        </el-button>
      </div>
    </div>

    <div class="dashboard-content">
      <UnitConversionProgress />
      <DataQuality />
    </div>

    <div class="dashboard-footer">
      <div class="status-indicator">
        <el-icon><CircleCheckFilled /></el-icon>
        <span>数据标准化状态: <span class="status-normal">正常</span></span>
      </div>
      <div class="last-update">
        最后更新时间: {{ currentTime }}
      </div>
    </div>
  </div>
</template>

<script setup>
import { ref, onMounted, onBeforeUnmount } from 'vue'
import { Refresh, CircleCheckFilled } from '@element-plus/icons-vue'
import UnitConversionProgress from './board/UnitConversionProgress.vue'
import DataQuality from './board/DataQuality.vue'
import {ElButton, ElIcon, ElOption, ElSelect} from "element-plus";

const dataSource = ref('source1')
const dataSources = [
  { value: 'source1', label: '频谱监测站' },
  { value: 'source2', label: '雷达信号采集' },
  { value: 'source3', label: '卫星遥感数据' }
]

const currentTime = ref('')
let timeInterval = null

const refreshData = () => {
  // 模拟数据刷新
  console.log('刷新数据...')
}

onMounted(() => {
  updateTime()
  timeInterval = setInterval(updateTime, 1000)
})

onBeforeUnmount(() => {
  clearInterval(timeInterval)
})

const updateTime = () => {
  const now = new Date()
  currentTime.value = `${now.getFullYear()}-${(now.getMonth() + 1).toString().padStart(2, '0')}-${now.getDate().toString().padStart(2, '0')} ${now.getHours().toString().padStart(2, '0')}:${now.getMinutes().toString().padStart(2, '0')}:${now.getSeconds().toString().padStart(2, '0')}`
}
</script>

<style scoped>
.data-governance-board {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 92vw;
  background: linear-gradient(135deg, #0c1124 0%, #182044 100%);
  font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
  color: #e4f0ff;
  overflow: hidden;
  padding: 1.5vh 2vw;
}

.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2vh;
  padding-bottom: 1.5vh;
  border-bottom: 1px solid rgba(75, 130, 230, 0.3);
}

.dashboard-title {
  font-size: 1.8rem;
  font-weight: 500;
  letter-spacing: 0.8px;
  background: linear-gradient(to right, #4db8ff, #9c42ff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 15px rgba(126, 87, 194, 0.4);
  margin: 0;
}

.dashboard-controls {
  display: flex;
  align-items: center;
  gap: 1vw;
}

.dashboard-content {
  display: flex;
  flex: 1;
  gap: 1.5vw;
  height: calc(100% - 15vh);
}

.dashboard-content > * {
  flex: 1;
  background: rgba(16, 22, 46, 0.65);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(64, 140, 246, 0.25);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(2, 8, 24, 0.4);
  overflow: hidden;
  position: relative;
  transition: all 0.3s ease;
}

.dashboard-content > *:hover {
  box-shadow: 0 8px 40px rgba(64, 140, 246, 0.3);
}

.dashboard-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1.5vh;
  padding-top: 1.5vh;
  border-top: 1px solid rgba(75, 130, 230, 0.3);
  font-size: 0.9rem;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 0.5vw;
}

.status-indicator .el-icon {
  color: #2ecc71;
}

.status-normal {
  color: #2ecc71;
  font-weight: 500;
}

.last-update {
  color: #a0bff0;
}
</style>